/*
 * Date: 22/7/2008
 * Author: rcote
 * File: uk.ac.ebi.jmzml.model.mzml.Run
 *
 * jmzml is Copyright 2008 The European Bioinformatics Institute
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *
 *
 */

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2008.06.19 at 10:48:08 AM BST
//


package uk.ac.ebi.jmzml.model.mzml;

import org.w3._2001.xmlschema.Adapter1;
import uk.ac.ebi.jmzml.model.mzml.params.RunCVParam;
import uk.ac.ebi.jmzml.model.mzml.params.RunUserParam;
import uk.ac.ebi.jmzml.model.mzml.utilities.ParamGroupUpdater;
import uk.ac.ebi.jmzml.xml.jaxb.adapters.InstrumentConfigurationAdapter;
import uk.ac.ebi.jmzml.xml.jaxb.adapters.SampleAdapter;

import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.util.Calendar;

/**
 * A run in mzML should correspond to a single, consecutive and coherent set of scans on an
 * instrument.
 * <p/>
 * <p/>
 * <p>Java class for RunType complex type.
 * <p/>
 * <p>The following schema fragment specifies the expected content contained within this class.
 * <p/>
 * <pre>
 * &lt;complexType name="RunType">
 *   &lt;complexContent>
 *     &lt;extension base="{http://psi.hupo.org/schema_revision/mzML_1.0.0}ParamGroupType">
 *       &lt;sequence>
 *         &lt;element name="sourceFileRefList" type="{http://psi.hupo.org/schema_revision/mzML_1.0.0}SourceFileRefListType" minOccurs="0"/>
 *         &lt;element name="spectrumList" type="{http://psi.hupo.org/schema_revision/mzML_1.0.0}SpectrumListType"/>
 *         &lt;element name="chromatogramList" type="{http://psi.hupo.org/schema_revision/mzML_1.0.0}ChromatogramListType" minOccurs="0"/>
 *       &lt;/sequence>
 *       &lt;attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}ID" />
 *       &lt;attribute name="defaultInstrumentConfigurationRef" use="required" type="{http://www.w3.org/2001/XMLSchema}IDREF" />
 *       &lt;attribute name="sampleRef" type="{http://www.w3.org/2001/XMLSchema}IDREF" />
 *       &lt;attribute name="startTimeStamp" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
 *     &lt;/extension>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RunType", propOrder = {
        "sourceFileRefList",
        "spectrumList",
        "chromatogramList"
        })
public class Run
        extends ParamGroup
        implements Serializable {

    private final static long serialVersionUID = 100L;
    protected SourceFileRefList sourceFileRefList;
    @XmlElement(required = true)
    protected SpectrumList spectrumList;
    protected ChromatogramList chromatogramList;
    @XmlAttribute(required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlID
    @XmlSchemaType(name = "ID")
    protected String id;
    @XmlAttribute(name = "defaultInstrumentConfigurationRef", required = true)
    @XmlJavaTypeAdapter(InstrumentConfigurationAdapter.class)
    @XmlSchemaType(name = "IDREF")
    protected InstrumentConfiguration defaultInstrumentConfiguration;
    @XmlAttribute(name = "sampleRef")
    @XmlJavaTypeAdapter(SampleAdapter.class)
    @XmlSchemaType(name = "IDREF")
    protected Sample sample;
    @XmlAttribute
    @XmlJavaTypeAdapter(Adapter1.class)
    @XmlSchemaType(name = "dateTime")
    protected Calendar startTimeStamp;

    /**
     * Gets the value of the sourceFileRefList property.
     *
     * @return possible object is
     *         {@link SourceFileRefList }
     */
    public SourceFileRefList getSourceFileRefList() {
        return sourceFileRefList;
    }

    /**
     * Sets the value of the sourceFileRefList property.
     *
     * @param value allowed object is
     *              {@link SourceFileRefList }
     */
    public void setSourceFileRefList(SourceFileRefList value) {
        this.sourceFileRefList = value;
    }

    /**
     * Gets the value of the spectrumList property.
     *
     * @return possible object is
     *         {@link SpectrumList }
     */
    public SpectrumList getSpectrumList() {
        return spectrumList;
    }

    /**
     * Sets the value of the spectrumList property.
     *
     * @param value allowed object is
     *              {@link SpectrumList }
     */
    public void setSpectrumList(SpectrumList value) {
        this.spectrumList = value;
    }

    /**
     * Gets the value of the chromatogramList property.
     *
     * @return possible object is
     *         {@link ChromatogramList }
     */
    public ChromatogramList getChromatogramList() {
        return chromatogramList;
    }

    /**
     * Sets the value of the chromatogramList property.
     *
     * @param value allowed object is
     *              {@link ChromatogramList }
     */
    public void setChromatogramList(ChromatogramList value) {
        this.chromatogramList = value;
    }

    /**
     * Gets the value of the id property.
     *
     * @return possible object is
     *         {@link String }
     */
    public String getId() {
        return id;
    }

    /**
     * Sets the value of the id property.
     *
     * @param value allowed object is
     *              {@link String }
     */
    public void setId(String value) {
        this.id = value;
    }

    /**
     * Gets the value of the defaultInstrumentConfiguration property.
     *
     * @return possible object is
     *         {@link String }
     */
    public InstrumentConfiguration getDefaultInstrumentConfiguration() {
        return defaultInstrumentConfiguration;
    }

    /**
     * Sets the value of the defaultInstrumentConfiguration property.
     *
     * @param value allowed object is
     *              {@link String }
     */
    public void setDefaultInstrumentConfiguration(InstrumentConfiguration value) {
        this.defaultInstrumentConfiguration = value;
    }

    /**
     * Gets the value of the sample property.
     *
     * @return possible object is
     *         {@link String }
     */
    public Sample getSample() {
        return sample;
    }

    /**
     * Sets the value of the sample property.
     *
     * @param value allowed object is
     *              {@link String }
     */
    public void setSample(Sample value) {
        this.sample = value;
    }

    /**
     * Gets the value of the startTimeStamp property.
     *
     * @return possible object is
     *         {@link String }
     */
    public Calendar getStartTimeStamp() {
        return startTimeStamp;
    }

    /**
     * Sets the value of the startTimeStamp property.
     *
     * @param value allowed object is
     *              {@link String }
     */
    public void setStartTimeStamp(Calendar value) {
        this.startTimeStamp = value;
    }

    private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
        try {

            //update our paramGroup list
            ParamGroupUpdater.updateParamGroupSubclasses(this, RunCVParam.class, RunUserParam.class);

        } catch (InstantiationException e) {
            throw new RuntimeException(this.getClass().getName() + ".afterUnmarshall: " + e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(this.getClass().getName() + ".afterUnmarshall: " + e.getMessage());
        }
    }

}
